package com.pay.plat.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.pay.entity.Order;
import com.pay.plat.annotation.AuthResource;
import com.pay.plat.mapping.MappingUtils;
import com.pay.service.IOrderService;
import com.pay.utils.BasePage;
import com.pay.utils.ResponseData;

@Controller
public class OrderController {

	@Autowired
	private IOrderService orderService ;
	
	@AuthResource
	@RequestMapping(value=MappingUtils.showOrderList)
	public ModelAndView showOrderList(Order order,BasePage<Order> page,Integer loginId) {
		orderService.getList(order,page) ;
		ModelAndView m = new ModelAndView(MappingUtils.showOrderList);
		m.addObject("loginId", loginId) ;
		m.addObject("list", page) ;
		m.addObject("order", order) ;
		return m ;
	}
	
	@AuthResource
	@ResponseBody
	@RequestMapping(value=MappingUtils.doOrderNotify,method= {RequestMethod.POST})
	public ResponseData doOrderNotify(Integer id) {
		return orderService.doOrderNotify(id) ;
	}
}
